From 439fcf75787e48a021981a0412c287187b7894d7 Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Sat, 21 Jan 2017 12:54:49 +0000 Subject: [PATCH] combobox: Remove property cell-area The CellArea is going to become a pure implementation detail & be moved to the .ui, instead of letting users mess with it (if anyone ever did). --- docs/reference/gtk/gtk4-sections.txt | 2 - gtk/gtkcombobox.c | 76 +------------------------- gtk/gtkcombobox.h | 4 -- tests/testtreemenu.c | 9 ---- testsuite/gtk/cellarea.c | 80 ---------------------------- 5 files changed, 1 insertion(+), 170 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 892980d1c8..0275499776 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -633,8 +633,6 @@ gtk_combo_box_new gtk_combo_box_new_with_entry gtk_combo_box_new_with_model gtk_combo_box_new_with_model_and_entry -gtk_combo_box_new_with_area -gtk_combo_box_new_with_area_and_entry gtk_combo_box_get_wrap_width gtk_combo_box_set_wrap_width gtk_combo_box_get_row_span_column diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index bb41e5e4c7..229f44852d 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -215,8 +215,7 @@ enum { PROP_ENTRY_TEXT_COLUMN, PROP_POPUP_FIXED_WIDTH, PROP_ID_COLUMN, - PROP_ACTIVE_ID, - PROP_CELL_AREA + PROP_ACTIVE_ID }; static guint combo_box_signals[LAST_SIGNAL] = {0,}; @@ -970,24 +969,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) TRUE, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - /** - * GtkComboBox:cell-area: - * - * The #GtkCellArea used to layout cell renderers for this combo box. - * - * If no area is specified when creating the combo box with gtk_combo_box_new_with_area() - * a horizontally oriented #GtkCellAreaBox will be used. - * - * Since: 3.0 - */ - g_object_class_install_property (object_class, - PROP_CELL_AREA, - g_param_spec_object ("cell-area", - P_("Cell Area"), - P_("The GtkCellArea used to layout cells"), - GTK_TYPE_CELL_AREA, - GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); - gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkcombobox.ui"); gtk_widget_class_bind_template_child_internal_private (widget_class, GtkComboBox, box); gtk_widget_class_bind_template_child_internal_private (widget_class, GtkComboBox, button); @@ -1077,7 +1058,6 @@ gtk_combo_box_set_property (GObject *object, { GtkComboBox *combo_box = GTK_COMBO_BOX (object); GtkComboBoxPrivate *priv = combo_box->priv; - GtkCellArea *area; switch (prop_id) { @@ -1153,22 +1133,6 @@ gtk_combo_box_set_property (GObject *object, gtk_combo_box_set_active_id (combo_box, g_value_get_string (value)); break; - case PROP_CELL_AREA: - /* Construct-only, can only be assigned once */ - area = g_value_get_object (value); - if (area) - { - if (priv->area != NULL) - { - g_warning ("cell-area has already been set, ignoring construct property"); - g_object_ref_sink (area); - g_object_unref (area); - } - else - priv->area = g_object_ref_sink (area); - } - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1242,10 +1206,6 @@ gtk_combo_box_get_property (GObject *object, g_value_set_string (value, gtk_combo_box_get_active_id (combo_box)); break; - case PROP_CELL_AREA: - g_value_set_object (value, priv->area); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2292,40 +2252,6 @@ gtk_combo_box_new (void) return g_object_new (GTK_TYPE_COMBO_BOX, NULL); } -/** - * gtk_combo_box_new_with_area: - * @area: the #GtkCellArea to use to layout cell renderers - * - * Creates a new empty #GtkComboBox using @area to layout cells. - * - * Returns: A new #GtkComboBox. - */ -GtkWidget * -gtk_combo_box_new_with_area (GtkCellArea *area) -{ - return g_object_new (GTK_TYPE_COMBO_BOX, "cell-area", area, NULL); -} - -/** - * gtk_combo_box_new_with_area_and_entry: - * @area: the #GtkCellArea to use to layout cell renderers - * - * Creates a new empty #GtkComboBox with an entry. - * - * The new combo box will use @area to layout cells. - * - * Returns: A new #GtkComboBox. - */ -GtkWidget * -gtk_combo_box_new_with_area_and_entry (GtkCellArea *area) -{ - return g_object_new (GTK_TYPE_COMBO_BOX, - "has-entry", TRUE, - "cell-area", area, - NULL); -} - - /** * gtk_combo_box_new_with_entry: * diff --git a/gtk/gtkcombobox.h b/gtk/gtkcombobox.h index 77130acb24..f5172e1166 100644 --- a/gtk/gtkcombobox.h +++ b/gtk/gtkcombobox.h @@ -80,10 +80,6 @@ GType gtk_combo_box_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL GtkWidget *gtk_combo_box_new (void); GDK_AVAILABLE_IN_ALL -GtkWidget *gtk_combo_box_new_with_area (GtkCellArea *area); -GDK_AVAILABLE_IN_ALL -GtkWidget *gtk_combo_box_new_with_area_and_entry (GtkCellArea *area); -GDK_AVAILABLE_IN_ALL GtkWidget *gtk_combo_box_new_with_entry (void); GDK_AVAILABLE_IN_ALL GtkWidget *gtk_combo_box_new_with_model (GtkTreeModel *model); diff --git a/tests/testtreemenu.c b/tests/testtreemenu.c index 3d2417ba97..befb40ff21 100644 --- a/tests/testtreemenu.c +++ b/tests/testtreemenu.c @@ -426,7 +426,6 @@ tree_menu (void) GtkWidget *window, *widget; GtkWidget *menubar, *vbox; GtkCellArea *area; - GtkTreeModel *store; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -438,7 +437,6 @@ tree_menu (void) menubar = gtk_menu_bar_new (); gtk_widget_show (menubar); - store = simple_tree_model (); area = create_cell_area (); #if _GTK_TREE_MENU_WAS_A_PUBLIC_CLASS_ @@ -461,13 +459,6 @@ tree_menu (void) gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE); #endif - /* Add a combo box with the same menu ! */ - widget = gtk_combo_box_new_with_area (area); - gtk_combo_box_set_model (GTK_COMBO_BOX (widget), store); - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); - gtk_widget_show (widget); - gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE); - /* Now add some controls */ widget = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal"); diff --git a/testsuite/gtk/cellarea.c b/testsuite/gtk/cellarea.c index 5e27bb5fbf..07e0027816 100644 --- a/testsuite/gtk/cellarea.c +++ b/testsuite/gtk/cellarea.c @@ -202,37 +202,6 @@ test_combobox_new (void) g_object_unref (view); } -/* test that new_with_area() keeps the provided area */ -static void -test_combobox_new_with_area (void) -{ - GtkWidget *view; - GtkCellArea *area; - - area = gtk_cell_area_box_new (); - view = gtk_combo_box_new_with_area (area); - g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area); - - g_object_ref_sink (view); - g_object_unref (view); -} - -/* test that g_object_new keeps the provided area */ -static void -test_combobox_object_new (void) -{ - GtkWidget *view; - GtkCellArea *area; - - area = gtk_cell_area_box_new (); - gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL); - view = g_object_new (GTK_TYPE_COMBO_BOX, "cell-area", area, NULL); - g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area); - - g_object_ref_sink (view); - g_object_unref (view); -} - typedef GtkComboBox MyComboBox; typedef GtkComboBoxClass MyComboBoxClass; @@ -281,24 +250,6 @@ test_combobox_subclass0 (void) g_object_unref (view); } -/* test that a combobox subclass keeps the provided area */ -static void -test_combobox_subclass1 (void) -{ - GtkWidget *view; - GtkCellArea *area; - - subclass_init = 0; - - area = gtk_cell_area_box_new (); - view = g_object_new (my_combo_box_get_type (), "cell-area", area, NULL); - g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view))); - g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL); - - g_object_ref_sink (view); - g_object_unref (view); -} - /* test we can access the area in subclass init */ static void test_combobox_subclass2 (void) @@ -317,32 +268,6 @@ test_combobox_subclass2 (void) g_object_unref (view); } -static void -test_combobox_subclass3_subprocess (void) -{ - GtkWidget *view; - GtkCellArea *area; - - subclass_init = 1; - - area = gtk_cell_area_box_new (); - view = g_object_new (my_combo_box_get_type (), "cell-area", area, NULL); - g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view))); - g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL); - - g_object_ref_sink (view); - g_object_unref (view); -} - -/* test we get a warning if an area is provided, but ignored */ -static void -test_combobox_subclass3 (void) -{ - g_test_trap_subprocess ("/tests/combobox-subclass3/subprocess", 0, 0); - g_test_trap_assert_failed (); - g_test_trap_assert_stderr ("*ignoring construct property*"); -} - /* test that we have a cell area after new() */ static void test_cellview_new (void) @@ -833,13 +758,8 @@ main (int argc, char *argv[]) g_test_add_func ("/tests/iconview-subclass3/subprocess", test_iconview_subclass3_subprocess); g_test_add_func ("/tests/combobox-new", test_combobox_new); - g_test_add_func ("/tests/combobox-new-with-area", test_combobox_new_with_area); - g_test_add_func ("/tests/combobox-object-new", test_combobox_object_new); g_test_add_func ("/tests/combobox-subclass0", test_combobox_subclass0); - g_test_add_func ("/tests/combobox-subclass1", test_combobox_subclass1); g_test_add_func ("/tests/combobox-subclass2", test_combobox_subclass2); - g_test_add_func ("/tests/combobox-subclass3", test_combobox_subclass3); - g_test_add_func ("/tests/combobox-subclass3/subprocess", test_combobox_subclass3_subprocess); g_test_add_func ("/tests/cellview-new", test_cellview_new); g_test_add_func ("/tests/cellview-new-with-context", test_cellview_new_with_context); -- 2.30.2